home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 581 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.4 KB  |  38 lines

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.std.c
  4. Subject: Re: Bit-field sizes
  5. Date: Sun, 17 Mar 96 00:20:01 GMT
  6. Organization: none
  7. Distribution: world
  8. Message-ID: <827022001snz@genesis.demon.co.uk>
  9. References: <nzRPxQ9ytZZA084yn@csn.net> <4hkgds$bbh@info1.sdrc.com> <4ho846$g2d@usenet.pa.dec.com> <4hpkcv$gjc@info1.sdrc.com>
  10. Reply-To: fred@genesis.demon.co.uk
  11. X-NNTP-Posting-Host: genesis.demon.co.uk
  12. X-Newsreader: Demon Internet Simple News v1.27
  13. X-Mail2News-Path: genesis.demon.co.uk
  14.  
  15. In article <4hpkcv$gjc@info1.sdrc.com> larry.jones@sdrc.com "Larry Jones" writes:
  16.  
  17. >Sure they can -- once you've declared a bit-field with a non-conforming
  18. >type you've invoked undefined behavior and the compiler is at liberty to
  19. >do anything it likes from then on.
  20.  
  21. There is a curious case here however. Lets say (with reference to 6.5.2.1)
  22. I declare:
  23.  
  24. struct bit {
  25.     long field : CHAR_BIT*sizeof(long) + 1;
  26. };
  27.  
  28. This results in undefined behaviour due to the long type of the declarator.
  29. However a constraint is also violated due to the field width. Is a diagnostic
  30. still required in this case or can the compiler omit it as a form of undefined
  31. behaviour?
  32.  
  33. -- 
  34. -----------------------------------------
  35. Lawrence Kirby | fred@genesis.demon.co.uk
  36. Wilts, England | 70734.126@compuserve.com
  37. -----------------------------------------
  38.